/*******************************************************************************
 * Copyright (c) 2022, 2022
 ******************************************************************************/
package com.alex.demo.rabbitmq.consumer;

import java.util.Date;

import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import com.alex.demo.rabbitmq.config.DelayedQueueConfig;

import lombok.extern.slf4j.Slf4j;

/**
 * @Version 1.0
 * @Author Alex
 * @Created Dec 2022/9/26 15:17
 * @Description
 *              <p>
 *              基于延迟插件的消费者
 */
@Slf4j
@Component
public class DelayQueueConsumer {

	@RabbitListener(queues = DelayedQueueConfig.DELAYED_QUEUE_NAME)
	public void receiveDelayQueue(Message message) {
		String msg = new String(message.getBody());
		log.info("当前时间：{}，收到延迟队列消息：{}", new Date().toString(), msg);
	}
}
